#include <stdio.h>
#include "seqstack.h"

//用线性表的顺序存储来模拟栈时
//在尾部添加或者删除元素,不会涉及到数组的元素大量的移动
//所以在尾部这一端操作好
int main(int argc, char const *argv[])
{
        int i = 0;
        int a[10] = {0};
        SeqStack* stack = NULL;
        
        stack = SeqStack_Create(10);
        if(stack == NULL){
                printf("stack create error\n");
                return -1;
        }

        //压栈
        for (i = 0; i < 5; i++){
                a[i] = i + 1;
                SeqStack_Push(stack, &a[i]);
        }

        printf("栈的容量:%d\n", SeqStack_Capacity(stack));
        printf("栈的长度:%d\n", SeqStack_Size(stack));
        printf("top:%d\n", *((int *)SeqStack_Top(stack)) );

        while ( SeqStack_Size(stack) > 0 ){
                int tmp = *((int *) SeqStack_Pop(stack));
                printf("%d ", tmp);
        }
        printf("\n");

        SeqStack_Destory(stack);
        return 0;
}
